<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CompanyDriver extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('company_driver',['comment'=>'公司司机表','engine'=>'InnoDB','encoding'=>'utf8mb4','collation'=>'utf8mb4_general_ci']);
        $table->addColumn('company_id', 'integer',['comment'=>'公司id','limit'=>11,'default'=>0,'null'=>false])
            ->addColumn('no', 'string',['comment'=>'司机编号','limit'=>50,'default'=>'','null'=>false])
            ->addColumn('name', 'string',['comment'=>'司机姓名','limit'=>50,'default'=>'','null'=>false])
            ->addColumn('phone', 'string',['comment'=>'司机手机号','limit'=>50,'default'=>'','null'=>false])
            ->addColumn('id_card', 'string',['comment'=>'身份证号','limit'=>50,'default'=>'','null'=>false])
            ->addColumn('status', 'integer',['comment'=>'状态 1正常 2禁用','limit'=>11,'default'=>1,'null'=>false])
            ->addColumn('job_status', 'integer',['comment'=>'在职状态 1在职 2离职','limit'=>11,'default'=>1,'null'=>false])
            ->addColumn('address', 'string',['comment'=>'地址','limit'=>255,'default'=>'','null'=>false])
            ->addColumn('sort', 'integer',['comment'=>'排序','limit'=>11,'default'=>0,'null'=>false])
            ->addColumn('remark', 'string',['comment'=>'备注','limit'=>255,'default'=>'','null'=>false])
            ->addColumn('create_time', 'integer',['comment'=>'创建时间','limit'=>11,'default'=>0,'null'=>false])
            ->addColumn('update_time', 'integer',['comment'=>'更新时间','limit'=>11,'default'=>0,'null'=>false])
            ->addColumn('delete_time', 'integer',['comment'=>'删除时间','limit'=>11,'default'=>0,'null'=>false])
            ->create();
    }
}
